package org.fengling.readingplatform.user.controller;

import io.swagger.v3.oas.annotations.Operation;
import org.fengling.readingplatform.model.vo.common.Result;
import org.fengling.readingplatform.model.vo.common.ResultCodeEnum;
import org.fengling.readingplatform.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("api/user/operate")
public class UserController {

    @Autowired
    private UserService userService;


    @Operation(summary = "会员签到")
    @PostMapping("/auth/sign")
    public Result sign(){
        userService.sign();
        return Result.build(null, ResultCodeEnum.SUCCESS);
    }

    @Operation(summary = "统计本月连续签到天数")
    @GetMapping("/auth/sign/count")
    public Result signCount(){
        int number = userService.signCount();
        return Result.build(number, ResultCodeEnum.SUCCESS);
    }

}
